package com.frogs.ucenter.v1.request;

import java.math.BigDecimal;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.OpenPlatformEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 任务动作日志记录
 * @author xiaohei
 *
 */
public class ActionLogRequest extends Request {

	private static final long serialVersionUID = -6281239952420692041L;
	private String actionType;
	private BigDecimal money;
	private Integer userId;
	private String remark;
	private Integer openPlatformId;
	
	
	public String getRemark() {
		return remark;
	}


	public void setRemark(String remark) {
		this.remark = remark;
	}


	public String getActionType() {
		return actionType;
	}


	public void setActionType(String actionType) {
		this.actionType = actionType;
	}


	public BigDecimal getMoney() {
		return money;
	}


	public void setMoney(BigDecimal money) {
		this.money = money;
	}


	public Integer getUserId() {
		return userId;
	}


	public void setUserId(Integer userId) {
		this.userId = userId;
	}


	public Integer getOpenPlatformId() {
		return openPlatformId;
	}


	public void setOpenPlatformId(Integer openPlatformId) {
		this.openPlatformId = openPlatformId;
	}


	@Override
	public void parse(HttpServletRequest request) {
		// TODO Auto-generated method stub
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.actionType = requestInfo.getParameter(ApiUrlParamEnum.actionType.getParamName(), "");
		this.money = requestInfo.getBigDecimalParameter(ApiUrlParamEnum.money.getParamName());
		this.remark = StringUtil.fixHtml(requestInfo.getParameter(ApiUrlParamEnum.remark.getParamName(), ""));
		this.openPlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.openPlatformId.getParamName(), OpenPlatformEnum.WECHAT_HDC.getId());
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
	}

}
